home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / IO Examples / Mandelbrot / FractalTypes.icl < prev    next >
Encoding:
Modula Implementation  |  1996-12-18  |  2.5 KB  |  120 lines  |  [TEXT/3PRM]

  1. implementation module FractalTypes
  2.  
  3. import deltaEventIO, deltaMenu, deltaWindow, deltaTimer, deltaPicture
  4.  
  5. MyWindow        :== 1
  6. MyPos            :== (0,0)
  7.  
  8. TimerID            :== 1
  9.  
  10. FileID            :== 2
  11. QuitID            :== 21
  12.  
  13. OptionsID        :== 3
  14. FixedDepthsID    :== 33
  15. Depth32ID            :== 331
  16. Depth64ID            :== 332
  17. Depth128ID            :== 333
  18. Depth256ID            :== 334
  19. Depth512ID            :== 335
  20. Depth1024ID            :== 336
  21. AreasID            :== 34
  22. Area1ID                :== 341
  23. Area2ID                :== 342
  24. Area3ID                :== 343
  25. Area4ID                :== 344
  26. Area5ID                :== 345
  27. Area6ID                :== 346
  28. Area7ID                :== 347
  29. FunctionsID        :== 35
  30. Function1ID            :== 351
  31. Function2ID            :== 352
  32. Function3ID            :== 353
  33. Function4ID            :== 354
  34. Function5ID            :== 355
  35. ColoursID        :== 36
  36. Colour1ID            :== 361
  37. Colour2ID            :== 362
  38. Colour3ID            :== 363
  39. Colour4ID            :== 364
  40. Colour5ID            :== 365
  41. CommandsID        :== 4
  42. DrawID                :== 41
  43. ZoomInID            :== 43
  44. ZoomOutID            :== 44
  45. StopDrawID            :== 45
  46. ContinueID            :== 46
  47.  
  48. ScreenWidth        :== 664        // was: 540
  49. ScreenHeight    :== 400        // was: 340
  50.  
  51. NrOfColours        :== 512
  52.  
  53. AreaIds            :== [Area1ID,Area2ID,Area3ID,Area4ID,Area5ID,Area6ID,Area7ID]
  54.  
  55. ::    FractalState
  56.     =    {    funstate    :: !FunctionState
  57.         ,    drawstate    :: !DrawState
  58.         ,    zoomstate    :: !ZoomState
  59.         }
  60. ::    FunctionState
  61.     =    {    area        :: !Area
  62.         ,    colours        :: !Colours
  63.         ,    depth        :: !CalcDepth
  64.         ,    fun            :: !FractalFunction
  65.         }
  66. ::    Area
  67.     =    {    center        :: !RPoint
  68.         ,    width        :: !Width
  69.         ,    height        :: !Height
  70.         }
  71. ::    RPoint
  72.     :==    (    !Real
  73.         ,    !Real
  74.         )
  75. ::    Width        :== Real
  76. ::    Height        :== Real
  77. ::    Colours        :== (!Int,!Int,!Int,!Int,!Int,!Int)
  78. ::    CalcDepth    :== Int
  79. ::    FractalFunction
  80.     =    MSquare
  81.     |    MCube
  82.     |    MSin
  83.     |    MCos
  84.     |    MExp
  85. ::    DrawState
  86.     =    {    layer    :: !Layer
  87.         ,    grain    :: !GrainSize
  88.         ,    line    :: !LineNr
  89.         }
  90. ::    Layer        :== Int
  91. ::    GrainSize    :== Int
  92. ::    LineNr        :== Int
  93. ::    ZoomState    :== Rectangle
  94.  
  95. ::    *IO            :== IOState *FractalState
  96.  
  97. SetFFunction :: !FractalFunction !*FractalState -> *FractalState
  98. SetFFunction newfunc state=:{funstate=fs}
  99. =    {state & funstate={fs & fun=newfunc}}
  100.    
  101. SetArea :: !Area !*FractalState -> *FractalState
  102. SetArea newarea state=:{funstate=fs}
  103. =    {state & funstate={fs & area=newarea}}
  104.    
  105. SetNrOfColours :: !Colours !*FractalState -> *FractalState
  106. SetNrOfColours newcolours state=:{funstate=fs}
  107. =    {state & funstate={fs & colours=newcolours}}
  108.    
  109. SetCalcDepth :: !CalcDepth !*FractalState -> *FractalState
  110. SetCalcDepth newdepth state=:{funstate=fs}
  111. =    {state & funstate={fs & depth=newdepth}}
  112.    
  113. SetDrawState :: !DrawState !*FractalState -> *FractalState
  114. SetDrawState newdraw state
  115. =    {state & drawstate=newdraw}
  116.  
  117. SetZoomState :: !ZoomState !*FractalState -> *FractalState
  118. SetZoomState newzoom state
  119. =    {state & zoomstate=newzoom}
  120.